import {defineStore} from 'pinia'
import {ref} from 'vue'
import {useSettingsStore} from './settings'
import {OpenedFileRecord} from "../../filespace/src";

export const useEditorStore = defineStore('editor', () => {
  const settingsStore = useSettingsStore()
  const openedNotes = ref<OpenedFileRecord[]>([])
  const activeNoteId = ref<string | null>(null)

  async function init() {
    openedNotes.value = await window.bnote.files.openeds()
  }

  return {
    init,
    openedNotes,
    activeNoteId
  }
})
